1. Field of the Invention
The present invention relates to the field of dynamic thresholds for threshold detectors.
2. Background Art
Threshold detection is a process whereby an input signal is compared to a predetermined value, hereinafter referred to as a threshold level, to determine if the input signal is higher or lower than the predetermined value. The threshold level may be considered a dividing line whereby an input signal is considered either logic level HIGH if it is equal to or above the threshold level or logic level LOW otherwise. A threshold detector is a device that implements this function and commonly comprises a comparator. It compares an input signal with a threshold level and outputs either a HIGH or LOW as stated above.
FIG. 1A illustrates an input signal, in this case a sinusoidal tone, crossing a constant threshold level V.sub.R. The output signal of a threshold detector detecting the input signal of FIG. 1A is illustrated in FIG. 1D. Prior to time t.sub.1, the input signal is lower than V.sub.R, thus, the output signal is LOW. However, at time t.sub.1, the input signal exceeds V.sub.R and remains above V.sub.R until time t.sub.2. The output signal of threshold detector shown in FIG. 1D correspondingly becomes HIGH at time t.sub.1 and remains HIGH until time t.sub.2. At time t.sub.2, the input signal decreases below V.sub.R, therefore, the output signal becomes LOW. Similar transitions in the output signal due to the input signal occur at times t.sub.3 and t.sub.4. In this manner, a pulse train having HIGH and LOW logic levels is produced by the threshold detector according to the input signal.
Threshold detection is used in many applications. For instance, heating systems often include a thermostat for maintaining a constant temperature. Such a heating system includes a threshold detector for determining when a temperature dependent input signal exceeds the threshold level set using the thermostat. When the temperature dependent input signal is below the threshold level, the heating system remains on. However, once it exceeds the threshold level, the heating system turns off.
Input signals often include noise (due to external noise sources, temperature variations, etc.). As a result of such noise, a "false" threshold crossing may occur causing the threshold detector to erroneously output an incorrect logic level. In order to increase the immunity to noise of the threshold detector, the threshold level can be adjusted dependent upon the input signal level and on the output of the threshold detector in order to prevent erroneous threshold crossings. This effect is commonly referred to as hysteresis.
For example, an input signal including noise is shown in FIG. 1B, however, this input signal includes noise. In FIG. 1B, a constant threshold level, V.sub.R, is indicated having a solid line. The drawing illustrates extra false threshold crossings after time t.sub.2 because noise in the input signal causes it to cross V.sub.R at times t.sub.3 and t.sub.4. The false threshold crossings due to noise produce an output signal which is illustrated in FIG. 1E. This output signal includes an extra pulses of short duration between times t.sub.3 and t.sub.4, thereby, differing from that of FIG. 1D due to noise.
Hysteresis provides greater immunity to noise of an input signal for threshold detection. By including hysteresis in the threshold detector, errors in the output signal can be reduced or removed completely. Hysteresis is illustrated in FIG. 1C. Instead of having a single threshold level, such as V.sub.R, a threshold detector including hysteresis has two or more threshold levels.
A high and low threshold level V.sub.TH (HI) and V.sub.TH (LO) are plotted in FIG. 1C as an upper and lower solid line, respectively. The voltage difference, V.sub.TH (HI)-V.sub.TH (LO), is the hysteresis magnitude. The threshold detector does not produce errors in the output signal if the amplitude of noise in the input signal is less than the hysteresis magnitude. Referring to the drawing of FIG. 1C, the input signal increases positively crossing V.sub.TH (HI) at time t.sub.1 causing the output signal of the threshold detector to change from LOW to HIGH. The output signal of the threshold detector remains HIGH even though the input signal decreases below V.sub.TH (HI). The output signal of the threshold detector changes to a logic level LOW only when the input signal decreases below V.sub.TH (LO) at time t.sub.2. Similarly, the output signal remains LOW until the input signal crosses V.sub.TH (HI) regardless of subsequent crossings of V.sub.TH (LO) due to noise.
An output signal of the threshold detector having hysteresis, as described above, is illustrated in FIG. 1F according to the input signal and hysteresis of FIG. 1C. By comparing FIG. 1F to FIG. 1E, it can be seen that the output signal of the threshold detector does not include erroneous transitions if the hysteresis magnitude is greater than the amplitude of noise in the input signal. Therefore, hysteresis provides the desirable effect of greater immunity to noise for threshold detection.
Often, hysteresis threshold detecting systems employ fixed upper and lower threshold levels. There are certain applications where fixed levels can lead to erroneous output. For example, electronic ignitions for combustion engines operating at various speeds may require the detection of an input signal having a frequency and an amplitude that varies according to the speed of a rotating engine component. This signal is applied to a threshold detector in order to produce a binary pulse train having transitions according to the input signal. At lower engine speeds, the input signal has lower amplitude and lower frequency. At higher engine speeds, the input signal is higher in amplitude and frequency.
At higher engine speeds, the input signal also includes higher noise levels. The noise is generated by such sources as engine vibrations and is generally a function of frequency, thereby, increasing to higher amplitude levels at higher input frequencies. Also, an input signal can have noise which is time dependent occurring in a certain portion of the input signal period. Erroneous threshold crossings can result in improper engine operation, therefore, accurate threshold crossing detection is desired.
Two important considerations for specifying hysteresis are the amplitude range of input signals and the amount of noise in the input signal. Input signals that are smaller in peak-to-peak amplitude than the magnitude of hysteresis cannot be detected properly. Therefore, a tradeoff exists between the range of input signals that can be detected and the magnitude of hysteresis required to prevent erroneous threshold crossings due to noise. As stated above, the noise of an input signal generally increases with frequency. Therefore, it is desirable to provide a greater magnitude of hysteresis for higher amplitude, higher frequency input signals than for lower amplitude, lower frequency input signals.
Three input signals are illustrated in FIG. 2 for a threshold detector having two fixed threshold levels. Hereinafter, the upper threshold level is referred to as the high switchpoint (HSP) and the lower threshold level is the low switchpoint (LSP). The input signal illustrated in FIG. 2A is a low amplitude, low frequency signal. The separation between the HSP and LSP is greater than the peak-to-peak amplitude of the input signal, thus, the input signal does not cross the HSP and LSP. Therefore, the threshold detector is not able to properly detect the input signal due to the separation between the HSP and LSP.
An input signal having nominal amplitude and frequency values is shown in .FIG. 2B. For such input signals having noise levels smaller than the separation between the HSP and LSP, the threshold detector is able to accurately detect threshold crossings of the input signal. However, for input signals with larger amplitudes at higher frequencies, there can be significantly more noise in the input signal. Such an input signal is illustrated in FIG. 2C where the separation between the HSP and LSP is not sufficient to prevent an erroneous threshold crossing due to noise at time t.sub.1.
For input signals having amplitudes that vary with frequency, time dependent hysteresis may provide greater immunity to noise for threshold detection. In time dependent hysteresis, the magnitude of hysteresis is variable having a range of threshold values which an input signal may cross according to the period of the input signal. The purpose of time dependent hysteresis is to detect an input signal without false threshold crossings even though the amplitude and noise of the input signal varies with the frequency of the input signal.
A prior art circuit for threshold detection having time and frequency dependent hysteresis is shown in FIG. 3. An input signal 330 is provided to the inverting input of amplifier 320 and is compared to a threshold level at a non-inverting input of amplifier 320. An output signal 340 is coupled to the non-inverting input of amplifier 320 by capacitor 360 and a resistor 350 is coupled between the non-inverting input and ground.
An input signal 330 is shown in FIG. 4A and a threshold signal having hysteresis according to the prior art circuit of FIG. 3 is illustrated in FIG. 4B. During the first cycle of the input signal, the magnitude of hysteresis is largest at times 0 and t.sub.1. At time 0, the input signal 330 causes amplifier 320 to go into negative saturation producing a negative threshold voltage across resistor 330. As capacitor 360 charges, the magnitude of hysteresis decays exponentially so that the threshold voltage increases toward its steady-state level of 0V. Similarly, at time t.sub.1, the input signal 330 decreases below the threshold voltage causing amplifier 320 to go into positive saturation, thereby producing a positive threshold voltage across resistor 330. FIG. 4B illustrates that the threshold voltage provides the largest immunity to noise at times 0 and t.sub.1 during the first cycle of the input signal, and provides less immunity to noise as the magnitude of hysteresis decreases exponentially. The rate of hysteresis decay of this prior art circuit is fixed due to capacitor 360 and resistor 350.
A second prior art threshold detector provides time and frequency dependent hysteresis similar to the prior art circuit described above having hysteresis decay that is determined by resistor and capacitor values. However, this prior art circuit provides feedback to the input node of the threshold detector so that the upper threshold level of hysteresis is pulled up to a higher voltage, thereby, further increasing the magnitude of hysteresis immediately after a threshold crossing. This device has the effect that the threshold detector blanks out portions of the input signal which cannot be detected for a period of time although a valid threshold crossing can occur.
There are several disadvantages to the prior art. One disadvantage is that the hysteresis pattern decreases according to analog resistor and capacitor values requiring large values to provide large time constants.
Another problem is that it is difficult to produce accurate analog resistor and capacitor values. Inaccurate analog resistor and capacitor values can generate inconsistent time constants for controlling threshold voltage hysteresis.
A further problem is that the hysteresis pattern often does not have any relationship to the input signal. The amplitude of the input signal may not be an exponential function of frequency. The RC circuit of the prior art locks the hysteresis into an exponentially decaying function regardless of how the amplitude of the input signal varies. Thus, the hysteresis may have no relationship to the input signal. Hysteresis may be required which changes linearly, logarithmically, or as a specially adapted function of the input signal.
Yet another disadvantage is that the time constant for the exponentially decaying hysteresis is not easily programmable due to the analog resistor and capacitor components.
A further disadvantage is that it provides little or no immunity to noise for transients that occur well after the hysteresis transition to its maximum value.
Finally, another disadvantage of the prior art is that blanking of the input signal to minimize false triggers eliminates the ability to detect a true input signal crossing during the blanking interval.
A third prior art threshold detector comprises a microprocessor circuit which measures the frequency of an input signal and then adjusts the magnitude of hysteresis by adjusting resistance values. This method has the disadvantage of being an after-the-fact method since it must first measure the input signal before changing the magnitude of hysteresis. Therefore, the hysteresis does not respond immediately to changes in the input signal frequency.